<?php 
/**
 * @Author: Kendy
 * @Date:   2019-11-11 09:59:15
 * @Last Modified by:   jiayanting
 * @Last Modified time: 2019-11-12 14:36:30
 */
namespace app\api\controller; 
use think\Model;
use think\Db;  
use think\Request;
use app\api\model\Guide as g; 
class Guide extends Nocommon
{
	/**
	 * [guideList 获取导游列表]
	 * @Author   kendy
	 * @DateTime 2019-11-11T10:01:56+0800
	 * @return   [type]                   [description]
	 */
	public function guideList()
	{
		if(Request::instance()->isPost()){
		  $guide = new g();  
          $keyword = input('keyword');  
          $limit = input('limit/d'); 
          if($keyword!='')$where['name'] = ['like','%'.$keyword.'%'];     
          $page = $this->p(); 
          $where['is_del'] = 0; 
          $where['is_pass'] = 1;  
          $GuideList = $guide->GetGuideList($where,$page,$limit);  
          return $this->apiReturn('200','成功',$GuideList);
		}

	}

	/**
	 * [guideInfo 导游详情]
	 * @Author   kendy
	 * @DateTime 2019-11-12T09:40:06+0800
	 * @return   [type]                   [description]
	 */
	public function  guideInfo()
	{
		if(Request::instance()->isPost()){
		  $guide = new g();
		  $guideId = input('post.guide_id');
		  if(empty($guideId)) 
		  return $this->apiReturn('400','导游id为空',0); 
          $GuideInfo = $guide->GetGuideInfoById($guideId);  
          return $this->apiReturn('200','成功',$GuideInfo);
		}
	}

	  /**
     * [GuideReserve 导游预定页面]
     * @Author   kendy
     * @DateTime 2019-11-198T11:14:09+0800
     */
    public function GuideReserve()
    {
      if(Request::instance()->isPost()){  
        $guideId = (int)input('post.guide_id');
        if(empty($guideId)) return $this->apiReturn('400','导游id为空',0);
        $guide = new g();
        $guideInfo = $guide->getGuideReserveInfo($guideId);  
         return $this->apiReturn('200','成功',$guideInfo); 
       } 
 
    }

}